<%@page import="org.apache.shiro.subject.Subject"%>
<%@page import="org.apache.shiro.SecurityUtils"%>
<%@page import="com.solution.common.utils.string.StringUtil"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html><html id="myhtml" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<meta content="" name="keywords"/>
<meta content="" name="description"/>
<title>登录</title>
<!-- 网站图标@xu_cc -->
<link rel="icon" href="${pageContext.request.contextPath}/statics/images/jx.ico" type="image/x-icon" />
<link rel="shortcut icon" href="${pageContext.request.contextPath}/statics/images/jx.ico" type="image/x-icon" />
<link rel="bookmark" href="${pageContext.request.contextPath}/statics/images/jx.ico" type="image/x-icon" />

<link href="<%=basePath%>statics/images/favicon.ico" rel="shortcut icon" type="images/x-icon"/>
<link href="<%=basePath%>statics/css/login.css" rel="stylesheet" />
<%
	// 如果用户已经登录，可以
	Subject currentUser = SecurityUtils.getSubject();
	if(currentUser.isAuthenticated()){
		response.sendRedirect(getServletContext().getContextPath()+"/entry");
	}
%>
</head>
<body>
	<jsp:include page="/page/browser_check.jsp" />
	<div class="wrap">
		<div class="header">
	    	<div class="header_con">
	        	<h1><h1 style="font-size:48px;">空调维修项目管理后台</h1></h1>
	        </div>
	    </div>
	    <div class="main">
	    	<div class="main_body">
	        	<div class="loginbox">
	            	<div class="loginbox_con">
	            		<div class="hd">
	                    	<h3>账户登录</h3>
	                    </div>
	    				<form  name="" id="login_form" method="post" action="<%=basePath%>login">
	                    <div class="login_form">
	                    	<dl>
	                        	<dt>
	                            	<strong class="icon1"></strong>
	                                <div class="txt1">
	                                	<input type="text" id="username"  name="username" class="inputstyle1" placeholder="用户名" value="admin" />
	                                </div>
	                            </dt>
	                            <dt>
	                            	<strong class="icon2"></strong>
	                                <div class="txt1">
	                                	<input type="password" id="password"  name="password"  class="inputstyle1" placeholder="密码" value="jx87787432" />
	                                </div>
	                            </dt>
	                            <div class="rember_part">
	                           		<span style="color:#ea4040;" >${param.error == "1" ? "用户名密码错误或用户禁用" : "" }</span>
	                            </div>
	                            <div style="margin:20px 0px;">&nbsp;</div>
	                            <div class="login_btn" >
	                            	<p><input type="submit" class="inputbtn1" value="登   录" />
	                                </p>
	                            </div>
	                        </dl>
	                    </div>
	                    </form>
	                </div>
	            </div>
	        </div>
	    </div>
	</div>

	<script src="<%=basePath%>statics/js/jquery.1.11.3.min.js"></script>
	<script type="text/javascript" src="<%=basePath%>statics/js/jquery.validation.min.js"></script>
<script>
$(function(){
	
	
	//$("#login_form").submit();
	
	if(window.top!=window.self){
		parent.location.href="<%=basePath%>/login.jsp";
	}
	$('#login_form').validate({
		
		submitHandler: function(form) {  
		
			form.submit();
			
       }  , 
        errorPlacement: function(error, element){
            var error_td = element.parent();
			error_td.addClass('erros');
			error_td.parent().removeClass('right').addClass('erro');
            error_td.append(error);$(error_td).click(function(){$(error_td).find('label').remove();$(error_td).parent().removeClass('erro');});
        },
        success : function(label){
			label.parent().removeClass('erros');
			label.parent().parent().removeClass('erro').addClass('right');
            label.addClass('validate_right').text('');
        },
        onkeyup: false,
        rules : {
            username : {
                required : true,
                minlength: 1,
				maxlength: 20
            },
            password : {
                required : true,
                minlength: 4,
				maxlength: 20
            }
        },
        messages : {
            username : {
                required : '请输入用户名',
				minlength: '请输入正确的用户名',
				maxlength: '请输入正确的用户名'
				
            },
            password  : {
                required : '请输入密码',
                minlength: '密码在6-20个字符之间',
				maxlength: '密码在6-20个字符之间'
            }
        }
    });

	
	});
</script>
</body>
</html>